home *** CD-ROM | disk | FTP | other *** search
Makefile | 1990-04-27 | 15.5 KB | 512 lines |
- case $CONFIG in
- '') . config.sh ;;
- esac
- outputfile=makefile
- rm -f $outputfile.$$
- echo "Creating $outputfile (with variable substitutions)"
- if cat >$outputfile.$$ <<!GROK!THIS!
- # RCSid[] = "@(#)$Header: makefile.SH,v 3.6 88/09/08 17:41:09 pb Exp $"
- # $Log: makefile.SH,v $
- # Revision 3.6 88/09/08 17:41:09 pb
- # Distribution of VME: VME + new level for errors + speed up + misc tidies
- #
- # Revision 3.5 88/05/27 06:30:33 pb
- # Distribution of EdText: Edtext + check .cf args + triple to file num + make to temp files
- #
- # Revision 3.4 87/10/13 18:22:22 pb
- # Distribution of NullStringsNotZero: Always retrun a valid - maybe null - string.
- #
- # Revision 3.3 87/05/16 06:21:01 pb
- # fix wdbm stuff and smail
- #
- # Revision 3.1 87/02/03 08:50:50 pb
- # Distribution of VmsAppRelayFix: Omit entries for VMS if application relay + DBM+PRIME formats
- #
- RCSsymbNAME=VME
- RCSmessage =VME + new level for errors + speed up + misc tidies
-
- # Copyright 1986, Piete Brooks, Julian Onions & Adrian Pell
- # pb@cl.cam.ac.uk, jpo@hcig.nott.ac.uk, Adrian.R.Pell@reading.ac.uk
- #
- # This program may be copied as long as you don't remove this notice,
- # try to make any money off of it, or pretend that you wrote it.
-
- # ANY MODS TO THIE FILE WILL BE DESTROYED.
- # It is made automatically from makefile.SH
-
- # The next four items are zapped by makefile.SH
- DATADIR = $datadir
- WDBM = $wdbm
- AWK = $awkf
- DIRSAMP = $dirsample # a test to see if new derfil1
- SMAILNAME=$smailname # the hostname for smail awk
-
- # May be over-ridden on the make command line (make SHAR=wombat ...)
- MAKE = make
- SHAR = shar
- SHAROPTS= #-c -v -p X
-
- #- The options are:
- #- help generate list of arguments for make
- #- configure start the ball rolling .....
- #-
- #- nrs (default) make the nrs program
- #- atomic fetch the NRS atomic files
- #-
- #- york generate york [ york dir compacted ]
- #- inst-york install the york directory
- #- york21 generate york21 (D2.1) [ single service entry ]
- #- inst-york21 install the york directory (D2.1)
- #- x25hosts generate x25hosts
- #- mmdf generate files as specified in mmdf.cf
- #- t.central generate text format like t.central
- #- vms5 generate vms format 5 files (new)
- #- vms4 generate vms format 4 files (old)
- #- sendmail generate files as specified in sendmail.cf
- #- smail generate Reading smail tables
- #- dbm1 generate dbm1 format files
- #- prime generate prime format files
- #- edtext generate a more readable text format (default format)
- #- simpleedtext generate a more readable text format (simple format)
- #- shortedtext generate a more readable text format (short format)
- #- longedtext generate a more readable text format (long format)
- #- bothedtext generate a more readable text format (l and s format)
- #- pp generate pp format files (dmn, chan & top)
- #-
- #- nrs.txt generate nroff version of nrs documentation
- #- SPD.txt generate printable version of SPD
- #- tags generate tags
- #- lint pass the sources through lint (!!)
- #- neat remove generated files other than .o
- #- tidy, clean remove all generated files (except nrs)
- #- clobber remove all generated files (EVEN nrs)
- #-
- #- tardist generate master nrs.tar
- #- shardist generate master nrs.shar
- #- primedist generate prime distribution
- #- unixdist generate unix distribution
- #- vmsdist generate vms distribution
- #-
- #- co check out all files
- #- ci check in all files (CIFLAGS=-r3.2)
-
- .SUFFIXES: .VMS .SH
-
- # The object files
- OBJS = \\
- config.o \\
- defs.o \\
- lru.o \\
- main.o \\
- misc.o \\
- output.o
-
- SRCS = \\
- config.c \\
- defs.c \\
- lru.c \\
- main.c \\
- misc.c \\
- output.c
-
- LOCALISE= config.sh
- LOCALS = makefile.SH Makefile \$(LOCALISE)
- HFILES = nrs.h
- SHFILES = central simple.awk smail.awk
- # These are remade by Configure
- FILESH = makefile.SH nrs.SH getfiles.SH \\
- mmdf.SH york.SH ryork.SH central.SH x25hosts.SH text.SH \\
- vms4.SH vms5.SH smail.SH sendmail.SH york21.SH ryork21.SH dbm1.SH \\
- prime.SH edtext.SH pp.SH
- FILES = nrs.h getfiles \\
- mmdf.cf york.cf ryork.cf central.cf x25hosts.cf text.cf \\
- vms4.cf vms5.cf smail.cf sendmail.cf york21.cf ryork21.cf dbm1.cf \\
- prime.cf edtext.cf pp.cf
- FILEVMS = nrs.VMS mmdf.VMS york.VMS ryork.VMS central.VMS x25hosts.VMS \\
- text.VMS vms4.VMS vms5.VMS smail.VMS sendmail.VMS york21.VMS \\
- ryork21.VMS dbm1.VMS prime.VMS edtext.VMS pp.VMS
- DOCSRCS = nrs.1 nrs.5 nrs.ms README SPD.ms
- DOCS = \$(DOCSRCS) nrs.txt SPD.txt
- SRCDIST = \$(SRCS) hdr.file vms4hdr.file vms5hdr.file
- BASEDIST= \$(SRCDIST) \$(DOCSRCS)
- PRIMEDIST=PRIME.LST \$(BASEDIST) make.cpl decompress.c nrs.hPRIME
- UNIXDIST= UNIX.LST Configure Makefile \$(BASEDIST) \$(FILESH) \$(SHFILES) wdbm.c
- VMSDIST = VMS.LST \$(BASEDIST) make.com stdconf.com $(FILEVMS)
- DIST = FULL.LST \$(SRCDIST) \$(DOCS) \\
- make.cpl decompress.c nrs.hPRIME \\
- Configure Makefile \$(FILESH) \$(SHFILES) wdbm.c \\
- make.com vms.com.ed stdconf.com
- RCS = \$(DOCSRCS) \$(SRCS) hdr.file vms4hdr.file vms5hdr.file \\
- make.cpl decompress.c nrs.hPRIME \\
- Configure Makefile \$(FILESH) \$(SHFILES) wdbm.c \\
- make.com vms.com.ed stdconf.com \$(FILEVMS)
- DIREC = /usr/lib/x25/directory # the york directory
- DIRECDBM= /usr/lib/x25/directory.pag # the york dbm directory
- LDFLAGS = -s
- CFLAGS = -O
- LFLAGS = -haxbc
- COFLAGS = -q
- CIFLAGS = -k # or -r3.2
-
- # Rules for building nrs
- #################################################################
- #################################################################
-
- initial: \$(LOCALISE) nrs
-
- nrs : \$(OBJS)
- \$(CC) \$(LDFLAGS) -o \$@ \$(OBJS)
-
- \$(OBJS) : \$(HFILES)
-
- # Rules for zapping the directories
- #################################################################
- #################################################################
-
- FULL.LST: makefile
- echo \$(DIST) | tr ' ' '\012' | sort -u > FULL.LST
-
- UNIX.LST: makefile
- echo \$(UNIXDIST) | tr ' ' '\012' | sort -u > UNIX.LST
-
- VMS.LST: makefile
- echo \$(VMSDIST) | tr ' ' '\012' | sort -u > VMS.LST
-
- PRIME.LST: makefile
- echo \$(PRIMEDIST) | tr ' ' '\012' | sort -u > PRIME.LST
-
- \$(FILES):
- $(MAKE) $(MFLAGS) configure
-
- \$(LOCALISE): Configure makefile
- $(MAKE) $(MFLAGS) configure
- touch \$(LOCALISE)
-
- configure: Configure UNIX.LST $(FILESH)
- sh Configure quick
-
-
- # Rules for fetching the NRS files to \$(DATADIR)/new
- #################################################################
- #################################################################
-
- atomic: \$(DATADIR)/new/\$(DIRSAMP)
-
- \$(DATADIR)/new/\$(DIRSAMP): \$(LOCALS) getfiles
- -@$(MAKE) $(MFLAGS) \$(DATADIR)/new
- sh getfiles
-
- \$(DATADIR)/new:
- mkdir \$(DATADIR)/new
-
- # Rules for building raw (D2.2) york directory
- #################################################################
- #################################################################
-
- york.raw: york.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs york.cf > york.raw
-
- ryork.raw: ryork.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs ryork.cf 'output reverse' > ryork.raw
-
- york.extra:
- @echo You must provide a file of extra local entries e.g. NEWS entries
- @echo Put them in \$@
- @false
-
- inst-york: \$(DIRECDBM)
-
- \$(DIRECDBM): \$(DIREC)
- \$(WDBM)
-
- \$(DIREC): york
- cp york \$(DIREC)
-
- # sort york.raw ryork.raw (NRS) & york.extra (local) > york.sort
- # merge lines of york.sort > york.simple
- # Now prefix comments and any other local additions > york
- #
- #################################################################
- #################################################################
-
- york: york.simple york.raw ryork.raw york.extra
- cat york.raw ryork.raw york.extra | grep \\^# > york
- -if [ -r york.local ] ; then cat york.local >> york; fi
- cat york.simple >> york
- -if [ -r york.aliases ] ; then cat york.aliases >> york; fi
-
- \$(WDBM) wdbm: wdbm.c
- cc wdbm.c -o wdbm -lx25
- mv wdbm \$(WDBM)
-
- york.sort: york.raw ryork.raw york.extra
- sort -t\\: york.raw ryork.raw york.extra +1 -2 +3 | \\
- grep -v \\^# > york.sort
-
- york.simple: york.sort simple.awk
- \$(AWK) simple.awk < york.sort > york.simple
-
- # YUCK YUCK Rules for building old format (D2.1) york directory
- #
- #################################################################
- #################################################################
-
- york21.raw: york21.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs york21.cf > york21.raw
-
- ryork21.raw: ryork21.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs ryork21.cf 'output reverse' > ryork21.raw
-
- york21.extra:
- @echo You must provide a file of extra local entries e.g. NEWS entries
- @echo Put them in \$@
- @false
-
- york21: york21.raw ryork21.raw york21.extra
- cat /dev/null > york21
- -if [ -r york21.local ] ; then cat york21.local >> york21; fi
- cat york21.raw ryork21.raw york21.extra >> york21
- -if [ -r york21.aliases ] ; then cat york21.aliases >> york21; fi
-
- inst-york21: york21
- cp york21 \$(DIREC)
-
- # Rules for building x25hosts
- #################################################################
- #################################################################
-
- x25hosts: x25hosts.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building mmdf tables + domains
- #################################################################
- #################################################################
-
- mmdf: mmdf.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf
-
- # Rules for building vms4 tables
- #################################################################
- #################################################################
-
- vms4: vms4.cf \$(DATADIR)/\$(DIRSAMP) vms4hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building vms5 tables
- #################################################################
- #################################################################
-
- vms5: vms5.cf \$(DATADIR)/\$(DIRSAMP) vms5hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building sendmail UK tables
- #################################################################
- #################################################################
-
- sendmail: sendmail.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building Reading sendmail tables
- #################################################################
- #################################################################
-
- smail: smail.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- echo '#sep space' > TMP.\$@
- -if [ -r \$@..local ] ; then cat \$@..local >> TMP.\$@; fi
- nrs \$@.cf >> TMP.\$@
- echo '#hostname $(SMAILNAME)' | cat - TMP.\$@ | \
- \$(AWK) \$@..awk>\$@..aliases
- mv TMP.\$@ \$@
-
- # Rules for building t.central format
- #################################################################
- #################################################################
-
- t.central: central central.cf \$(DATADIR)/\$(DIRSAMP)
- central > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building dbm1 format
- #################################################################
- #################################################################
-
- dbm1: dbm1.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@
- nrs \$@.cf "output reverse" >> TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building prime format
- #################################################################
- #################################################################
-
- prime: prime.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for building prime format
- #################################################################
- #################################################################
-
- edtext shortedtext: edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@
- mv TMP.\$@ \$@
- longedtext: edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@ "output edtext long"
- mv TMP.\$@ \$@
- bothedtext: edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@ "output edtext short long"
- mv TMP.\$@ \$@
- simpleedtext: edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf > TMP.\$@ "output edtext simple"
- mv TMP.\$@ \$@
-
- # Rules for building pp format
- #################################################################
- #################################################################
-
- pp: pp.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
- nrs \$@.cf
-
- # Rules for making text version of SPD.ms
- #################################################################
- #################################################################
-
- SPD.txt: SPD.ms
- nroff -ms SPD.ms > TMP.\$@
- mv TMP.\$@ \$@
-
- # Rules for making text version of nrs.ms
- #################################################################
- #################################################################
-
- nrs.txt: nrs.ms
- nroff -ms nrs.ms > TMP.\$@
- mv TMP.\$@ \$@
-
- # Miscellaneous tasks
- #################################################################
- #################################################################
-
- help : makefile
- @sed -e '/^#-/s/#-//p' -e d makefile
-
- tags : \$(SRCS) \$(HFILES)
- ctags -t \$(SRCS) \$(HFILES)
-
- lint : \$(SRCS) \$(HFILES)
- lint \$(LFLAGS) \$(SRCS)
-
- tardist : nrs.tar
- nrs.tar : \$(DIST)
- tar cvf nrs.tar \$(DIST)
-
- shardist: nrs.shar
- nrs.shar : \$(DIST) FULL.LST
- \$(SHAR) \$(SHAROPTS) \`cat FULL.LST\` > nrs.shar
-
-
- primedist: nrs.comi
- nrs.comi: \$(PRIMEDIST) PRIME.LST
- ( echo 'como -ntty /* switch off command output */'; \\
- echo '/* Now start the loop ......*/'; \\
- for file in \`cat PRIME.LST\`; \\
- do echo 'ed /* get good old ed */'; \\
- echo ''; \\
- echo ' brief'; \\
- echo ' mode nosemi'; \\
- echo ' symbol esc '; \\
- echo ' symbol tab '; \\
- echo ' erase '; \\
- echo ' kill '; \\
- echo ''; \\
- sed 's/^/X/' < \$\$file; \\
- echo ''; \\
- echo ' top'; \\
- echo ' change/X//32767'; \\
- echo ' file' \`echo \$\$file | sed s/.c\$\$/.cc/\`; \\
- echo ''; \\
- done; \\
- echo '/* Thats is the loop done....tidy up*/'; \\
- echo 'como -tty /* switch command output back on */'; \\
- echo ''; \\
- echo 'comi -end /* finish up the command input file */'\\
- ) > nrs.comi
-
- $(FILEVMS): vms.com.ed
- .SH.VMS:
- cat \$*.SH > \$*.VMS
- ed - \$*.VMS < vms.com.ed
-
- vmsdist: nrs.com
- nrs.com : \$(VMSDIST) VMS.LST
- for file in \`cat VMS.LST\`; \\
- do echo '\$\$ WRITE SYS\$\$OUTPUT " Creating' \$\$file'"'; \\
- echo '\$\$ CREATE' \$\$file; \\
- echo '\$\$ DECKS/DOLLARS="XXXXX-EOF-XXXXX"'; \\
- grep '' \$\$file; \\
- echo 'XXXXX-EOF-XXXXX'; \\
- done > nrs.com
-
-
- unixdist: nrs-shar
- nrs-shar : \$(UNIXDIST) UNIX.LST
- \$(SHAR) \$(SHAROPTS) \`cat UNIX.LST\` > nrs-shar
-
- co : ALWAYS
- co \$(COFLAGS) \$(RCS)
-
- ci : ALWAYS
- @echo ci -m\\"Distribution of \$(RCSsymbNAME): \$(RCSmessage)\\"\\
- \$(CIFLAGS) -N\\"\$(RCSsymbNAME)\\" \$(RCS) ... well almost ...
- @for target in \$(RCS) ; do \\
- rc=true; \\
- if [ -r "\$\$target" ]; \\
- then if co -p -q "\$\$target" | cmp -s - "\$\$target"; \\
- then rm -f "\$\$target"; \\
- else rcs -l "\$\$target"; \\
- ci -m"Distribution of \$(RCSsymbNAME): \$(RCSmessage)" \$(CIFLAGS) -N"\$(RCSsymbNAME)" "\$\$target"; \\
- rc=false; \\
- fi; \\
- fi; \\
- if \$\$rc; \\
- then eval \`rlog -h \$\$target | awk '{ if (\$\$1 == "head:") print "vers=\\"" \$\$2 "\\""}'\`; \\
- rcs -N\$(RCSsymbNAME):\$\$vers -sRel "\$\$target"; \\
- fi; \\
- done
-
- tidy : clean
- clean : neat
- rm -f \$(OBJS)
-
- neat :
- rm -f core a.out nrs.sh nrs.tar .emacs* *.CKP TMP.* \\
- *-dmn *.map *.pag *.dir *.dat *-chan \\
- york york.raw ryork.raw york.sort york.simple \\
- york.old york.sort.old york.simple.old \\
- york21 york21.raw ryork21.raw york21.sort york21.simple \\
- york21.old york21.sort.old york21.simple.old \\
- vms sendmail smail t.central nrs.txt x25hosts
-
- clobber: clean
- rm -f nrs *.cf
-
- ALWAYS:
- !GROK!THIS!
- then if cmp $outputfile $outputfile.$$ > /dev/null 2>& 1
- then
- rm -f $outputfile.$$
- echo " " $outputfile not affected
- elif mv $outputfile.$$ $outputfile
- then
- echo " " $outputfile updated
- else
- echo "+++ " $outputfile left in $outputfile.$$
- fi
- else
- echo " " Failed to create $outputfile.$$
- fi
-